package com.example.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        // 执行这个方法的时候，bean 的属性已经被填充好了。
        System.out.println("postProcessBeforeInitialization(Object bean, String beanName)方法被调用，bean:" + bean + ", beanName:" + beanName);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("postProcessAfterInitialization(Object bean, String beanName)方法被调用，bean:" + bean + ", beanName:" + beanName);
        return bean;
    }
}
